	//弹出对话框
	function OutMessageBox(content,ico,time){
		$.msgbox.show({
	        message: content,
	        icon: ico,
	        timeOut: time,
	        beforeHide: function(){
	 			//自定义的提示框
	        }
	    });
	}
	//弹出评论回复框
	function commReply(id,obj){
		var replyDom = "<div style=\" margin-top:10px;margin-left:10px;margin-right:10px;\">"
		+"<span style=\"font-size:12px;color:burlywood;\">文明上网理性发言，请遵守新闻评论服务协议</span>"
		+"<textarea id=\"replyText\" maxlength=\"240\" required=\"required\">"
		+"</textarea>"
		+"<span id='replyErrorMessage' style=\"color:red;\"></span>"
		+"<div>";
		replyid = id;
		if(replyid!=""){
			JqueryDialog.OpenNoIframe('回复留言',replyDom, 520, 170);
			$("body").css({"overflow-y":"hidden"});
			JqueryDialog.Okfunction="submitCommReply()";
		}
	}
	//弹出查看评论回复框
	function queryReply(id,obj){
		replyid = id;
		var replyListDom = "<div id=\"replyListDiv\">"
		+"<ul id=\"replyListul\"></ul><span id=\"replyMore\" onclick=\"moreReply("+id+")\">正在加载</span></div>";
		if(id!=""){
			replyPageIndex = 1;
			JqueryDialog.OpenNoIframe('查看回复', replyListDom, 520, 300);
			$("body").css({"overflow-y":"hidden"});
			moreReply(replyid);
		}
	}
	//点击更多的回复
	function moreReply(id){
		//ajax使用分页的功能获取数据
			$("#replyMore").text("请稍后。。。");
			replyListAjax(id);   //ajax方法执行
			replyPageIndex = replyPageIndex+1; //添加了一页
	}
	//点击我的评论
	function myComment(obj){
		$("#hotPageIndex").val(1);
		$("#newPageIndex").val(1);
		$("#hotCommentListUl li").remove();
		$("#newCommentListUl li").remove();
		$("#hotCommentListUl").append("<span class='ajaxTitp'>请稍等。。。</span>");
		moreComment('my',"");
		$(".ajaxTitp").remove();
		$("#newCommentListUl").hide();
		$(obj).css({"background-color":"deepskyblue"});
		$(obj).prev().css({"background-color":"white"});
		$("h4").text("我的评论");
		$("#morenew").hide();
		
	}
	//页面上显示的所有评论
	function allComment(obj){
		$("#hotPageIndex").val(1);
		$("#newPageIndex").val(1);
		$("#newCommentListUl").show();
		$("#hotCommentListUl li").remove();
		$("#newCommentListUl li").remove();
		$("#hotComment h4").text("热门评论");
		$("#hnewComment h4").text("最新评论");
		$("#morenew").show();
		$("#hotCommentListUl").append("<span class='ajaxTitp'>请稍等。。。</span>");
		moreComment('hot',"");
		$("#newCommentListUl").append("<span class='ajaxTitp'>请稍等。。。</span>");
		moreComment('new',"");
		$(".ajaxTitp").remove();
		$(obj).css({"background-color":"deepskyblue"});
		$(obj).next().css({"background-color":"white"});

	}
	//更多评论
	function moreComment(type,obj){
		$(obj).text("正在加载。。。");
		var pageIndex = $("#hotPageIndex").val();
		if(type=="new"){
			pageIndex=$("#newPageIndex").val();
		}
		//使用ajax对列表进行填充
		$.ajax({
					type : "post",
					url :  contentPath+"/website/QueryComment.do",
					data : {
							"articleId" : artId,
							"page.pageSize" : 5,
							"page.pageIndex" : pageIndex,
							"commentType":type
							}, 
					dataType:"html",
					success : function(result) {
							if(type=="hot"||type=="my"){
								$("#hotCommentListUl").append(result);
									if(type=="hot"){
										$("#hotPageIndex").val($("#hotPageIndex").val()*1+1);
									}
									if(obj!=""){
										$(obj).text("加载更多");
									}
							}
							if(type=="new"){
								$("#newCommentListUl").append(result);
								if(type=="new"){
									$("#newPageIndex").val($("#newPageIndex").val()*1+1);
								}
								if(obj!=""){
									$(obj).text("加载更多");
								}
							}	
						},
					error: function(){
						$("#hotCommentListUl").append("请求出错!");
						if(obj!=""){
							$(obj).text("重新加载");
						}
					}
				});
	}
	//回复评论的ajax方法
	function replyListAjax(commId){//###################################
		//使用ajax对列表进行填充
		$.ajax({
					type : "post",
					 url : contentPath+"/website/QueryCommentReply.do",
					data : {
							"commentId" : commId,
							"page.pageSize" : 5,
							"page.pageIndex" : replyPageIndex,
							}, 
					dataType:"html",
					success : function(result) {
							//$("#replyListul").text(result);
							if(result==""){
								$("#replyMore").text("没有更多了！");
							}else{
					        	$("#replyListul").append(result);
					        	$("#replyMore").text("加载更多↓");
					        }
						},
					error: function(){
						$("#replyListul").append("<li class='replyLiMessage'>请求出错!</li>");
						$("#replyMore").text("重新加载!");
					}
				});
	}
	//点击喜欢或不喜欢
	function likeOrdisLike(obj,type,commid,number){
		var action = contentPath+"/website/AddPraise.do";
		if(type=="dislike"){
			action = contentPath+"/website/AddDislike.do";
		}
		$.ajax({
					type : "post",
					url : action,
					data : {
							"commentId" : commid
							}, 
					success : function(result) {
								if(result == null || result == ""||result == "false"){
									OutMessageBox("你已经点过了","no","1000");
								}else{
									if(type=="dislike"){
										$(obj).text("不喜欢("+(number+1)+")");
									}else{
										$(obj).text("已赞("+(number+1)+")");
									}
								}
						}
				});
	}
	var artid = $("#articleId").val;
	if(artid==""||artid==0){
		document.getElementById("commentBtn").disabled = true;
	}
	$("#comContent").val(contentStr);
	function submitComm(){
		document.getElementById("commentBtn").disabled = true;
		var comContent = $("#comContent").val();
		//过滤是否是只输入了空格和或者换行
		var comContentValid = comContent.replace(/\ /g,"").replace(/\n/g,'');
		if(comContentValid==""){
			document.getElementById("errorMessage").innerHTML="请输入您评论";
			document.getElementById("commentBtn").disabled = false;
			return false;
		}
		
		try{
			comContent = ImgIputHandler.replaceFace(comContent);  //替换头像
			if(comContent.length>1000){
				document.getElementById("errorMessage").innerHTML="输入的表情或字符太多了";
				document.getElementById("commentBtn").disabled = false;
				return false;
			}
			$("#contentStr").val(comContent);
		}catch (e) {
			document.getElementById("errorMessage").innerHTML="解析您的评论失败请重新输入";
			console.log(e);
			document.getElementById("commentBtn").disabled = false;
			return false;
		}
		return true;
	}
	//提交评论回复
	function submitCommReply(){
		var comContent = $("#replyText").val();
		if(replyid==""){
			return false;
		}
		//过滤是否是只输入了空格和或者换行
		var comContentValid = comContent.replace(/\ /g,"").replace(/\n/g,'');
		if(comContentValid==""){
			document.getElementById("replyErrorMessage").innerHTML="请输入您的回复";
			return false;
		}
		
	    if(comContent.length>240){
			document.getElementById("replyErrorMessage").innerHTML="输入的字太多了";
			return false;
	    }
	    OutMessageBox("等待回复请稍后!","warn","2000");
	    $("#jd_submit").attr("disabled","disabled");
	    $.ajax({
					type : "post",
					url  : contentPath+"/website/AddCommentReply.do",
					data : {
							"content" : comContent,
							"replyId" : replyid,
							"articleId":artId
							}, 
					success : function(result) {
								if(result == '0'){
									OutMessageBox("回复成功!","ok","3000");
									$("#jd_submit").attr("disabled","");
									JqueryDialog.Close();
									$("body").css({"overflow":"auto"});
								}else{
									OutMessageBox("回复失败!","no","3000");
									 $("#jd_submit").attr("disabled","");
								}
					},
					error : function(){
						 $("#jd_submit").attr("disabled","");
					}
				});
	}
	//查询最热的或最新的评论
	function selectHotorNew(type,obj){
		if(type=="hot"){
			$("#hotComment").insertBefore($("#newComment"));
		}else{
			$("#newComment").insertBefore($("#hotComment"));
		}
		$(obj).css({"background-color":"deepskyblue"});
		$(obj).next().css({"background-color":"white"});
		$(obj).prev().css({"background-color":"white"});
	}
	//回复评论的ajax
	function reportComment(objId,id,num){
		$.ajax({
					type : "post",
					 url : contentPath+"/website/AddReport.do",
					data : {
							"commentId" : id
							}, 
				 success : function(result) {
								if(result == null || result == ""||result == "false"){
									OutMessageBox("你已经举报过了","no","1000");
								}else{
									OutMessageBox("举报成功!","ok","1000");
									num=num+1;
									$("#"+objId).text("已举报("+num+")");
								}
						}
			});
	}